package com.bestcem.xm.wallet.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * 发票通知邮件配置类型
 *
 * @author qiongyu.cui <qiongyu.cui@idiaoyan.com>
 * @version v1.0
 * @date 2022/6/26 20:53
 */
@AllArgsConstructor
@Getter
public enum InvoiceNotifyEmailTypeEnum {

    /**
     * 发票通知邮件配置类型
     */
    TEST(1, "测试账号"),
    REAL(2, "真实账号");

    private Integer type;
    private String desc;

    /**
     * 根据type获取发票邮箱配置类型枚举
     * @param type type
     * @return com.bestcem.xm.wallet.enums.InvoiceNotifyEmailTypeEnum
     * @author cuiqiongyu <qiongyu.cui@idiaoyan.cn>
     * @date 2022/06/26 20:55
     */
    public static InvoiceNotifyEmailTypeEnum getByType(Integer type) {
        return Stream.of(values()).filter(i -> i.getType().equals(type)).findFirst().orElse(null);
    }

}
